package fragment;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.administrator.gongxiangcheng.R;

import java.util.ArrayList;
import java.util.List;

import adapter.RecyAdapter;
import base.BaseFragment;

/**
 * Created by Administrator on 2017/3/28.
 */
@SuppressLint("ValidFragment")
public class FleiFragment2 extends Fragment{
    private RecyclerView recyclerView;
    private LinearLayoutManager mLayoutManager;
    private RecyAdapter mAdapter;
    private List<String> mData;



    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.flei_fragment2, container,false);
        mData = new ArrayList<>();
        for(int i=0;i<20;i++){
            mData.add("Item "+i);
        }
        recyclerView = (RecyclerView) v.findViewById(R.id.my_flei2_recycle);
        mLayoutManager = new LinearLayoutManager(getActivity());
        //2 为RecyclerView创建布局管理器，这里使用的是LinearLayoutManager，表示里面的Item排列是线性排列
        recyclerView.setLayoutManager(mLayoutManager);
        mAdapter = new RecyAdapter(mData);
        //3 设置数据适配器
        recyclerView.setAdapter(mAdapter);
        return v;
    }
}
